package clock;

/** The ClickCounter application class. */

public class AlarmClock extends Object {

  private static final int DEFAULT_HR = 0;
  private static final int DEFAULT_MIN = 0;
  
  private static final int MAX_HR = 23;
  private static final int MAX_MIN = 59;
  
  private int clicksCounted;
  
  private int minCounted , hrCounted ;
  private int alarmMinCount = 0, alarmHrCount = 0;
  
  public AlarmClock() {
    this(DEFAULT_HR, DEFAULT_MIN);
  } // End default constructor.

  public AlarmClock(int minutes) {
    this(DEFAULT_HR, minutes);
  } // End alternative constructor.

  public AlarmClock(int hours, int minutes) {
    minCounted  = minutes;
    hrCounted  = hours;
  } // End alternative constructor.

  // Minutes count
  public void countmin() {
  	if (minCounted!=MAX_MIN) {
  		minCounted++;
  	} // End if.
  	else if (minCounted==MAX_MIN){
  		minCounted=0;
  		hrCounted++;
  	} // End if.
  }// End countmin.

  //Counts the hours depending upon minutes
  public void counthr() {
  	if (hrCounted!=MAX_HR) {
  		hrCounted++;
  	} // End if.
  	else if (hrCounted==MAX_HR){
  		hrCounted=0;
   	} // End if.

  }// End counthr.
  
  // Count Alarm Min
  public void countAlarmMin() {
  	if (alarmMinCount!=MAX_MIN) {
  		alarmMinCount++;
  	} // End if.
  	else if (alarmMinCount==MAX_MIN){
  		alarmMinCount=0;
  		alarmHrCount++;
  	} // End if.
  }// End countmin.

  //Counts the Alarm Hours depending upon minutes
  public void countAlarmHr() {
  	if (alarmHrCount!=MAX_HR) {
  		alarmHrCount++;
  	} // End if.
  	else if (alarmHrCount==MAX_HR){
  		alarmHrCount=0;
  	} // End if.

  }// End countAlarmhr.
  
  // Minute count
  public int mincountIs() {
  	return minCounted;
  } // End countIs.
  
  // Hour count
  public int hrcountIs() {
  	return hrCounted;
  } // End hrcountIs.
  
  // Alarm Minute Count
  public int alarmMinCountIs() {
  	return alarmMinCount;
  } // End countIs.
  
  //Alarm Hour count
  public int alarmHrCountIs() {
  	return alarmHrCount;
  } // End hrcountIs.
  
  // Check if alarm time is reached
  public boolean isAlarmTimeReached(){
  	if(hrcountIs() == alarmHrCountIs() 
  			&& mincountIs() == alarmMinCountIs())
  		return true;
  	return false;
  }
} // End AlarmClock;
